import { createRouter, createWebHistory } from 'vue-router'
const Home=()=>import("../components/Home")
const HomeMessage=()=>import("../components/HomeMessage")
const HomeNews=()=>import("../components/HomeNews")

const About=()=>import("../components/About")
const User=()=>import("../components/User")
const Profile=()=>import("../components/Profile")
const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '',
        redirect: '/home/message'
      },
      {
        path: 'message',
        component: HomeMessage
      },
      {
        path: 'news',
        component: HomeNews
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    component: About
  },
  {
    path: '/user/:userId',
    name: 'User',
    component: User
  },
  {
    path: '/profile',
    name: 'Profile',
    component: Profile
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router
console.log(router);
